package org.com.wareon.sql;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class SQLDB {
	Connection con =null;
	Statement stmt = null;
	ResultSet rs = null;
	private String spaltenNamen[];
	private String host;
	private String user;
	private String password;
	
	public SQLDB(String host,String user, String password) throws ClassNotFoundException, SQLException{	
		this.host=host;
		this.user=user;
		this.password=password;
	}
	public void dbClose() throws SQLException{
		if(isConected()){
			this.rs.close();
			this.stmt.close();
			this.con.close();
		}
	}
	public boolean isConected() throws SQLException{
		return !con.isClosed();
		
	}
	public boolean connect() throws ClassNotFoundException, SQLException{
		Class.forName("com.mysql.jdbc.Driver").getInterfaces();
		this.con=DriverManager.getConnection("jdbc:mysql://"+this.host,this.user,this.password);	
		this.stmt=con.createStatement();
		return isConected();
	}

}
